﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FbKPI.Facade;
using FbKPI.Model;

namespace FBKPI.Forms
{
    public partial class DivisionForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int ID = Convert.ToInt16(Request.QueryString["ID"]);
                if (ID != 0)
                {
                    DivisionFacade df = new DivisionFacade();
                    Division division = df.GetDivisionByID(ID);

                    if (division != null)
                    {
                        txt_id.Text = division.ID.ToString();
                        hfId.Value = division.ID.ToString();
                        txt_description.Text = division.Description;
                        chk_active.Checked = division.isActive;
                        //txt_lastmodifieddate.Text = division.LastModifiedDate == null ? "" : Convert.ToDateTime(division.LastModifiedDate).ToShortDateString();
                        //txt_lastmodifiedby.Text = division.LastModifiedBy;
                        //txt_createdate.Text = division.CreateDate == null ? "" : Convert.ToDateTime(division.CreateDate).ToShortDateString();
                        //txt_createby.Text = division.CreateBy;
                    }
                }
                else
                {
                    txt_id.Text = "0";
                }

                //if (txt_id.Text == "0") btn_delete.Visible = false;
            }
        }
    }
}